/*
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * RSOptics.h
 *
 *  Created on: 2010/03/07
 *      Author: Alexandre Pires ( c.alexandre.pires@gmail.com )
 */

#ifndef RSOPTICS_H_
#define RSOPTICS_H_

#include "RSElement.h"

namespace Realsphere {

    class RSOptics : public Realsphere::RSElement {
        Q_OBJECT
        public:
            RSOptics ();
            virtual ~RSOptics ();

        public:
            RSProjectionTechnique*      ProjectionTechnique () const;
            RSTechnique*                GetTechnique ( unsigned int rIndex ) const;
            RSTechnique*                GetTechnique ( const QString& profile ) const;
            int                         IndexOf ( RSTechnique* rTechnique );
            unsigned int                TechniquesSize ();
            RSTechniques                Techniques () const;
            RSTechniquesIterator        TechniquesIterator () const;
            QMatrix4x4                  ProjectionMatrix () const;
            bool                        IsRootElement () const;

        public slots:
            RSError                     SetProjectionTechnique ( RSProjectionTechnique* rTechnique );
            RSError                     AddTechnique ( RSTechnique* rTechnique );
            RSError                     RemoveTechnique ( RSTechnique* rTechnique );
            RSError                     RemoveTechnique ( unsigned int rIndex );
            RSError                     RemoveTechnique ( const QString& rProfile );

        signals:
            void                        TechniqueAdded ( RSTechnique* rTechnique );
            void                        TechniqueRemoved ( RSTechnique* rTechnique );
            void                        ProjectionTechniqueAdded ( RSTechniqueCommon* rTechnique );
            void                        ProjectionTechniqueRemoved ( RSTechniqueCommon* rTechnique );
            void                        ProjectionChanged ();

        protected:
            RSError                     BeforeAddChildElement ( RSElement* rChild );
            bool                        AfterAddChildElement ( RSElement* rChild );
            bool                        AfterRemoveChildElement ( RSElement* rChild );

        private:
            RSProjectionTechnique*      mProjectionTechnique;
            RSTechniques                mTechniques;
    };
}

#endif /* RSOPTICS_H_ */
